home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / util / conv / Cas2Wav.lha / Cas2Wav.txt < prev    next >
Encoding:
Text File  |  2002-02-18  |  32.3 KB  |  540 lines

  1. Atari classic tape generator program.  Version March 1999.
  2.  
  3. Preface.
  4.  
  5. This program is intended to be used with the wav2cas program that I
  6. wrote in may of 1997.  A lot of the technical hoopla involved in
  7. storing information on cassettes is explained in the documentation
  8. that came with that program.  If you are not familiar with it, I
  9. suggest you first read that stuff.  If you do not have it, download it
  10. from the Umich archives, or send me an E-mail.
  11.  
  12. Purpose of this project.
  13.  
  14. The design goal of this project is to convert the digital tape format,
  15. introduced with the wav2cas project, back to a format that will enable
  16. us to re-create a cassette that can then be loaded on a regular
  17. Classic Atari equipped with any of the supported cassette units.  The
  18. data is thus re-saved onto cassette tape.  This can be used to clean
  19. up faulty tapes that contain dropouts, spikes, noise, or other
  20. problems.  Data that is damaged can be restored, or repaired.  The
  21. data on the new tape could be saved at a higher baud rate, thus
  22. slightly reducing the time required to load the tape.  The quality of
  23. the cassette tape can be greatly improved in this way.  The cassette
  24. data is encoded into a .wav file, which should then be played back
  25. through a .wav player program.  The audio can then be recorded onto an
  26. audio cassette using a standard audio cassette recorder.  Since the
  27. cassette data is recorded using only a sound card and some software,
  28. there is no need for an Atari cassette unit.  Data can be retrieved
  29. from, and saved to cassette tapes even if your cassette unit is
  30. broken, unreliable, or otherwise not available.  You will need a
  31. regular audio cassette recorder of course.  If you want to load the
  32. cassette again, you will need an Atari and an Atari cassette unit, but
  33. these do not have to be connected to the PC.  You could go to a friend
  34. with your tapes and process them on her/his PC if you do not have such
  35. a device yourself.
  36.  
  37. Theory of operation.
  38.  
  39. Data must be saved onto cassette tape.  To do this, the data must be
  40. converted to some audio format.  Converting the data to an audio
  41. format is accomplished by converting the digital data into a .wav
  42. file, which holds the audio information that results from encoding the
  43. data.  Data is encoded on the cassette tape as a frequency shift
  44. keying audio signal, usually referred to as FSK.  For the
  45. non-technical persons, this means that an audio tone is recorded on
  46. the tape that has either one frequency, referred to as the mark tone,
  47. or another frequency, called the space tone.  Normally, the POKEY chip
  48. within the Classic Atari generates these tones, based on the bits of
  49. the data to be encoded, but this time we do it all in software.  We
  50. add the start bit and the stop bit for each byte.  All the bytes to be
  51. encoded are stored in the cassette records, including the marker bytes
  52. and the checksum.  Data is normally encoded at 600 baud.  The mark
  53. tone is usually 5327 Hertz.  The space tone is usually 3995 Hertz.
  54. This, along with the information stored in the .cas file, enables us
  55. to create a .wav file that contains all the bits encoded in the FSK
  56. audio format.  The bytes to be encoded are stored in the cassette
  57. records within the .cas file.  These records also tell us the length
  58. of the IRG and the PRWT, and the length of the leader.  For
  59. experimental purposes, we can attempt to increase reliability by
  60. tweaking these values, especially if we want to attempt to create a
  61. cassette that is encoded at a non-standard baud rate.
  62.  
  63. Writing data to a cassette tape.
  64.  
  65. Once a .wav file is created by the program, we simply play it back
  66. with a .wav player program, and record it onto the cassette tape.
  67. Never ever input this audio signal into the Atari computer DATA IN
  68. line directly, since this might damage your system.  The audio signal
  69. from the cassette tape must be converted to digital data by the Atari
  70. cassette unit, thus we must first record it to a tape with our audio
  71. cassette recorder.  Adjust the recording level as you would with any
  72. other sound.  The data should be recorded on the right channel.  If
  73. you want, you can record some music on the left channel, or whatever
  74. else you would like to hear while loading the tape.  If you like to
  75. hear the FSK tones, you can record the data on both channels.  The
  76. Classic Atari likes this 'music', but you might not particularly like
  77. it, or even call it noise, like your parents did with your music, so
  78. switch off your speakers, or turn the volume down.  If you do not
  79. record anything on the left channel, set the recording level to zero
  80. for the left channel.  You should take care that the length of the
  81. leader does not become excessive.  Some leader is already included in
  82. the .wav file.  If you do not start playing back the .wav file in
  83. time, the leader might become too long.  Do not make it too short
  84. either though.  If you start the player and the cassette deck
  85. simultaneously, you will be able to control the length of the leader
  86. by entering the proper value in the program.
  87.  
  88. Just a few words about playing back a wave file are in place.  I have
  89. tried a couple of programs to playback a .wav file.  One of the things
  90. to watch is the fact that you will be processing a lot of data.  If
  91. your hard drive is fragmented, the system will need more time to read
  92. the data.  Since the sampling rate is high, this could cause your
  93. player program to skip a few samples while it is busy reading data
  94. from disk.  I did not program that stuff, I would assume the program
  95. continues to play samples from memory, but somehow it looks like the
  96. O.S. disables the interrupts while doing I/O, so it will simply miss a
  97. few samples sometimes.  This might also be caused by the fact that
  98. there are other tasks in the system that are allowed to use the system
  99. resources for a while.  I have seen this happen with an Operating
  100. System that was released in 1998.  You can check this by recording the
  101. audio file to a .wav file again, and then looking at the wave file
  102. with a wave editor.  You should then be able to find the spot where
  103. the system could not keep up, especially if we are generating a very
  104. clean FSK signal.  Since this problem occurs randomly, it is hard to
  105. do anything about it.  You could simply create a 32 meg ram disk and
  106. run DOS, but not everybody is so fortunate to have memory in
  107. abundance.  A fast hard drive is nice too, and it will do most of the
  108. time.  If you cannot avoid this problem, simply record the file again,
  109. until you have a clean copy.  It would be nice to have a utility that
  110. adds music to the left channel, so that we could listen and hear the
  111. bad spot on the tape.  All we would need is a program that takes two
  112. mono .wav files and merge them into one stereo .wav file.  Anyone
  113. interested in writing such a utility?  Maybe such a utility already
  114. exists?
  115.  
  116. Generating a .wav file.
  117.  
  118. We want to generate a .wav file.  A wave file starts with a header
  119. that specifies the sampling rate and other technical stuff.  A wave
  120. file is a file in the standard RIFF file format, and documentation on
  121. this subject is available, so I will not go into detail here.  The
  122. RIFF file header is written, then the wave chunk header is written to
  123. the file, and we write the sampling rate and all the other information
  124. about the format of the wave file to the header.  Then we write the
  125. data header.  The headers contain the length of the file, and the
  126. length of the chunk, so we have to memorize the file position where
  127. these numbers are supposed to be.  When we are done writing the file,
  128. we must come back and update these values.  After the headers, we can
  129. start the sample data for the audio level of the wave.  According to
  130. the specifications, if the number of bytes in the chunk is odd, we
  131. will have to add a slack byte to the end.  When we are done writing
  132. the sample data, we add this slack byte if it is required, and then we
  133. update the length of the file and the length of the chunk.
  134.  
  135. The sample data is a very huge list of PCM values ranging from 0 to
  136. 255.  We generate these samples based on the tone we want to
  137. represent, which is dictated by the values of the bits we want to
  138. encode.  We know that we want to write either mark or space tones.
  139. Based on the frequency of these two tones, we generate a table for
  140. each tone.  The table holds the PCM sample data for one second of that
  141. tone.  The mark tone is usually 5327 Hertz.  This means there are 5327
  142. periods in one second.  We want to make a sine wave, because we like
  143. pure tones, so we need to compute the amplitude of the signal as a
  144. function of the time since the start of the tone.  We do this by
  145. computing the sine value of the time since zero.  Now you cannot input
  146. time into a sine function, only degrees or radians, thus we have to
  147. convert the time.  So let us choose radians, for no obvious reason.
  148. One period equals 2 PI radians.  If we had chosen degrees, it would
  149. have been 360 degrees of course.  Now we are generating one second of
  150. sine wave stuff, and over that second, we will generate the sample
  151. value for 44,100 samples.  The frequency tells us how many periods
  152. there are within that second, so this means we have 5327 times 2 PI
  153. radians within one second.  Our sample rate is the time value.  When
  154. we have generated 44,100 samples, one second has passed.  The sample
  155. number is our index into the table we wish to generate.  Now we can
  156. compute the amplitude by multiplying our time value by the number of
  157. radians that one time element represents, and inputting that into the
  158. sine function.  Thus we multiply the index into our table by the
  159. number of radians within one second, divided by the sampling rate.
  160. The output of the sine function is a value from -1 to 1, so we have to
  161. multiply this result by some value to increase the value to a level
  162. which we can use for the PCM sample values.  Also, we have to add 128
  163. in order to make it a positive number.  If we multiply it by too much,
  164. the sound might become distorted a bit, so I choose a value of 64 for
  165. this.  Since we have one second of samples in our table, we know that
  166. for any integer frequency value the end of our table will wrap nicely
  167. around to the start of the table again for a clean sine wave.  The
  168. tables can be used to quickly write a large number of samples to the
  169. .wav file.
  170.  
  171. We wanted the output to be a clean sine wave form.  This can be
  172. accomplished with the following procedure.  While writing data to the
  173. .wav file, the program keeps track of the value of the tone we were
  174. writing to the .wav file, either mark or space.  If we need to write a
  175. mark tone, and the previous tone we wrote also happened to be a mark
  176. tone, the program continues to write the wave form from where it left
  177. off in the table the last time.  The same is true for the space tone.
  178. Thus, if two consecutive bits have the same value, the wave continues
  179. smoothly on, as if nothing happened.  If the tone is different, the
  180. last sample value we wrote to the file is noted.  Then we determine
  181. whether the wave form was going up or down in amplitude.  Then this
  182. last value is searched for in the table of the other tone.  Of course
  183. the level must also match the fact whether it is rising or falling.
  184. When the match is found, we continue on with the other table from that
  185. point.  This makes a smooth transition from one tone to another.  At
  186. first I had it wait for the level to pass zero before changing over
  187. the tone, but this also works nice, and it results in a more exact bit
  188. length.  Now why did we want a clean wave?  Because it looks nice, or
  189. maybe because it sounds nice.  But our only and most important goal
  190. should be, can we load the tape every time without a load error?  Do
  191. not worry about what it sounds like, check the track record, does it
  192. load okay?  This made me experiment more, and the result is another
  193. way of encoding data in waves.  The key point seems to be to have the
  194. FSK decoder detect when the change in the tone occurs.  We should
  195. therefore make sure that the wave starts and stops exactly where the
  196. bits start and stop, to make it easier for the FSK decoder.
  197. Unfortunately you cannot have it both ways, since if you make the wave
  198. start at a certain point, chances that the period ends when the bit is
  199. supposed to end are close to zero, unless you tamper with the
  200. frequency.  The end of the space tone seemed to cause the most
  201. problems, so I choose to make the waves end when the space tone is
  202. supposed to end, and start when the mark bit is supposed to start.
  203. This makes a clean change from space to mark.  The not so smooth
  204. change over at the change from mark to space seems to have little
  205. effect on the decoded bits, so this looks like it is the best encoding
  206. format.  The way to accomplish this encoding scheme is to write the
  207. requested number of samples from the end of the table for the space
  208. tone, and the beginning of the table for the mark tone.  These tables
  209. are sure to start and end in a way that makes a smooth change.  The
  210. program calls this a transition at the zero level, even though only
  211. one of the two transitions actually occurs at the zero level.
  212.  
  213. The baud rate can be selected.  If the default baud rate is used, we
  214. find 600 bits per second on a tape.  Since we need 44,100 samples for
  215. each second, a bit will last about 44,100 samples divided by 600 bits,
  216. which is 73.5 samples.  Half a sample does not exist, so we would have
  217. to write 73 samples per bit.  For each bit that we encode, we would
  218. write 73 samples in this case.  This means that in effect, our bit rate
  219. would be slightly off from the selected value.  This is not a problem
  220. for loading the tape, but we can do better.  If we would process the
  221. bits in groups of a byte, we would have to compute how many samples
  222. are required for one byte, and then evenly distribute that over the 10
  223. bits that make up a byte.  This is only important if we want to
  224. generate a tape that exactly matches the baud rate entered.  If we do
  225. not mind that the baud rate is slightly off, this is just extra
  226. complexity that is not needed.
  227.  
  228. There is another reason why we would create the bits in groups of a
  229. byte though.  I have noticed that if you have a test tape that
  230. alternates between mark and space tones, with bits of equal number of
  231. samples, that the space bits appear to be slightly shorter.  It looks
  232. like the space tone detection takes a little while to kick in.  For
  233. the mark tone, this is really not important, since in the absence of a
  234. space tone, a mark bit value is output by the cassette unit, even if
  235. there is no mark tone present, so the detection of the space tone
  236. appears to be the most crucial.  The mark tone does prevent erroneous
  237. detection of the space tone, but the space tone is just more
  238. important.  If we wanted to compensate for this, we could actually
  239. make the space tone bits on the tape start a little early.  We cannot
  240. simply change the length of the space bit though, since the total
  241. length of the byte should remain the same.  This means we have to
  242. steal a couple of samples from the mark tone following it.  Of course
  243. it takes some time before the decoding circuit detects that the space
  244. tone is gone again.  Again, we can compensate for this, by having the
  245. space tone stop a little early, and give these samples to the mark
  246. tone following it.  However, stopping seems to be very simple.  In
  247. fact it is so simple, that sometimes the last portion of the bit is
  248. not detected as a space tone, and the last few samples are treated as
  249. part of the mark tone following it.  This makes the bit shorter so we
  250. would have to make it longer again.  Confused?  So was I!  I have
  251. played around with this a great deal, and it all seems to be related
  252. to the way the two tones change over.  Compensating for this does seem
  253. to improve reliability at the higher baud rates.  The only problem is
  254. that I suspect that the compensation requirements of various cassette
  255. units might differ.  If so, a tape that would load on one unit, might
  256. fail to load on another.  Don't worry too much though, since these
  257. problems with loading should only occur when the baud rate is around
  258. 820 baud.
  259.  
  260. The maximum baud rate that the standard O.S. will program the POKEY
  261. chip for when doing cassette reads is 820 baud.  If we go beyond that,
  262. we are depending on the POKEY chip to cope with the deviation.  It
  263. does seem to cope with some deviation.  I tried to improve the signal
  264. such that we could even load a tape at 875 baud, a value that seems to
  265. be the limit if you use the CAS2SIO program.  I have experimented a
  266. bit with adjusting the bit sizes and such, but in the end, what you
  267. really end up doing is simply reducing the size of the stop bit.  The
  268. higher baud rate results in a smaller bit size.  As long as the last
  269. data bit is presented at the time that it would be expected at 820
  270. baud, POKEY seems to be able to decode the bit, and then the stop bit
  271. is just a lot shorter.  The Atari has plenty of time to grab the byte
  272. from POKEY and store it somewhere, and then it can even compute the
  273. checksum.  It does not need the time that the stop bit represents.
  274. POKEY also seems to not mind.  So if this is all we wanted, it would
  275. be better to reduce the length of the stop bit, and encode the tape at
  276. 820 baud.  I don't think this little extra speed is worth the loss of
  277. reliability.
  278.  
  279. If we know how many samples to generate per bit, we can now write the
  280. record to the tape.  We begin with the IRG/PRWT, which is specified as
  281. a number of milliseconds.  We have to divide this by 1000 and multiply
  282. it by the sample rate to get the sample count.  This number of samples
  283. is then written to the file, by writing the corresponding piece of
  284. tone data from the mark table.  Then we start encoding the bytes of
  285. the record one by one.  We write the data for the bits from the mark
  286. or space table based on the value of the bits.  We start with the
  287. start bit, then the least significant bit of the data byte, followed by
  288. the other bits one by one, and finally the stop bit.  Since we are
  289. processing bits by the byte, as discussed just now, we sum the length
  290. of the bits if they are alike, adjusting the bit length sometimes to
  291. evenly distribute the samples over the byte, and then compensate for
  292. the space tone delays.
  293.  
  294. Tapes differ is length, depending on how much data is stored on them.
  295. Some tapes are 16K or less, other tapes are 48K or more.  Most tapes
  296. require roughly 2.5 seconds per block of 128 bytes, which is 20
  297. seconds per kilobyte.  A 16K tape will take about 5 minutes, a 48K
  298. tape could easily take 15 minutes or more.  At a sampling rate of
  299. 44,100 samples per second, we will have to write 44,100 bytes of data
  300. for each second of audio, or about 2.5 Megabytes per minute.  A
  301. fifteen minute tape will easily consume over 30 Megabytes of disk
  302. space.  If you do not have that much hard disk space available, you
  303. should backup some data and make space available, or simply buy a
  304. bigger hard disk, since hard disks are very cheap nowadays.  If the
  305. program runs out of disk space, it reports a write error.
  306.  
  307. Command line options.
  308.  
  309. Running the CAS2WAV program is easy.  You have two options.  You can
  310. run it interactively, by simply starting it.  It will ask for the
  311. filename.  Once that is entered, it will ask you to enter whether or
  312. not you want the diagnostics to be printed.  This program does not
  313. provide a lot of diagnostics, it will tell you at what offset in the
  314. .wav file a data record starts.  The only time this appears to be
  315. useful is when you sample the created tape again, to see if the .wav
  316. file has been properly transferred to an audio tape.  If you have a
  317. slow computer, this option also shows you that the system is still
  318. busy working, otherwise, you might think that the system crashed.  It
  319. does take a little while sometimes, depending on the size of the file,
  320. and also on the option selected for the way the tone changes over.
  321. If you wish this diagnostic data to be printed, it will be printed to
  322. the screen.  The output can be redirected to a file using the standard
  323. DOS redirection, but that would redirect the prompts to the redirected
  324. output too, so this is only recommended if you use the command line
  325. arguments.  You are then asked to enter various information that is
  326. used for encoding the data on the tape.  If you enter nothing, the
  327. default values for these settings are used.  You only have to enter
  328. something if you want something non-standard.  The wave format of the
  329. tones can be selected, either sine waves or block waves.  There are
  330. two flavors of sine waves, one with an immediate change over, and
  331. one which only changes at the next zero crossing, which is a pure
  332. sine wave so to speak.  If you want the zero crossing to occur at the
  333. time the bit is supposed to end, select the zero crossing option.
  334. This zero crossing works as described earlier.  The baud rate should
  335. be something around 600.  If you want to experiment with higher
  336. speeds, you can enter a higher value.  Values up to 850 baud seem to
  337. work.  Above that, load errors start to occur.  If you enter a fixed
  338. value, the baud rate values stored in the cassette file will be
  339. ignored.  The frequencies used for the mark and space tones can be
  340. altered too.  If you think your cassette unit prefers some other
  341. frequency, you can try adjusting the frequencies a bit.  The standard
  342. frequencies seem to work fine on my cassette units though.  Finally,
  343. the length of the leader tone and the length of the Inter Record Gap
  344. can be set to a fixed value.  If you enter a fixed value, the values
  345. from the cassette file will be ignored and overridden by the values
  346. entered.  The leader value is used for the length of the beginning of
  347. the tape.  The IRG value is used for any IRG on the tape that lasts
  348. less than 3 seconds.  You can enter all this on the command line if
  349. you prefer.  The file to process is the first argument on the command
  350. line.  The printing of diagnostic data is an option switch, which can
  351. be selected by adding /d to the command.  The wave form can be
  352. selected by using the /w switch, specifying sine waves, block waves,
  353. or pure waves.  Add the letter s, b or p after the w.  If you want to
  354. try the zero transition, add the /z switch to the command.  The value
  355. of the baud rate can be selected by using the /b switch, specifying the
  356. desired baud rate.  The frequency for the mark tone can be selected with
  357. the /m switch, for the space tone it is the /s switch.  The length of
  358. the leader can be specified with the /l switch, and the IRG length can
  359. be set using the /i switch.  These last five switches take a decimal
  360. number for setting the value, so setting the baud rate to 820 would
  361. require you to enter /b=820 on the command line.  The equals sign is
  362. optional, but do not insert any spaces between the switch and the value.
  363. There is no check for weird values, so what you enter is what you get.
  364. If you enter very strange values, you might even be able to make the
  365. program crash, or hang, so if you do enter a value like that, don't do
  366. it again.  I am not going to add checks for these values, in order for
  367. people to be able to experiment.
  368.  
  369. If no command line arguments are given, the program will prompt for
  370. the file.  The program allows the user to exit the interactive request
  371. for data by entering control Z.  On most PC's, pressing control-BREAK
  372. will also terminate the program.  I used the Symantec C++ compiler on
  373. the PC.  If you press control-BREAK, it will terminate the program as
  374. soon as it tries to write to the screen.  If the CAS2WAV program
  375. happens to be in the middle of writing some data, this may take a few
  376. moments though.
  377.  
  378. There is one special command line option that cannot be selected in
  379. the interactive mode.  The /t option generates a test tape for
  380. examining the quality of the FSK decoder inside the cassette unit.
  381. Any filename that is entered is ignored, since the filename for a test
  382. tape will always be "testtape.wav".  The number after the /t specifies
  383. the length of the tape in milliseconds.  The other options are all
  384. still valid, so you can experiment with various frequencies and
  385. baud rates.  The test tape wave file will contain some form of
  386. alternating mark and space tones, each one bit long.  This is intended
  387. for viewing the output of the FSK decoder on an oscilloscope.  The
  388. signal should be a block form with all bits equal in length.  In order
  389. to make the cassette unit play the tape, you will have to connect it
  390. to an Atari.  You can either try to boot the tape, using the normal
  391. procedure, or you can enter the command from BASIC to start the
  392. cassette motor.  If you enter POKE 54018,52 the motor will be turned
  393. on.  Note that some cassette units draw their power from the computer
  394. via the SIO bus, so another reason to connect it to the computer.  The
  395. cassette output on the DATA IN line is also designed such that you
  396. need to connect it to the computer if you want to measure the result
  397. with an oscilloscope.  The oscilloscope should be connected to the
  398. DATA IN line to view the signal.  If you recorded the audio to both
  399. channels, you can connect the AUDIO IN line to the second input if you
  400. have a dual beam oscilloscope.  By experimenting with this, you can
  401. try to determine what frequency works best.  Of course, it is advised
  402. to use the standard frequencies, but it is fun to experiment with this.
  403. Note that a test tape cannot actually be loaded, since it is not in the
  404. proper format.  It can only be used to test the FSK decoder.  You can
  405. modify the program to generate different test patterns.
  406.  
  407. I have used this test tape feature a lot to investigate how the FSK
  408. decoder reacts to different ways of changing the tones from mark to
  409. space and back.  At one point I even created a bi-tone signal, where
  410. the mark and the space tone were both present at the same time.  I
  411. only made one of them louder than the other, depending on the bit to
  412. be encoded.  Even then did the FSK decoder generate the correct bits.
  413. I thought that if the space tone is present all the time, the decoder
  414. might not have as much trouble to see the start of the space bit, but
  415. it looks like this does not make a difference, since the space bits
  416. were still shorter sometimes.  Eventually I tried using a block wave,
  417. since at some point I doubted that the FSK decoder really likes sine
  418. waves.  To my amazement, this resulted in a rock solid output.  Using
  419. the diagnostic tape, the edges of the bits were stable, which
  420. indicates that the FSK decoder reacted in a stable way to changing
  421. over from mark to space and back.  So I even wanted to make this the
  422. default wave form, but now it is up to you.  Even though I have spent
  423. a considerable amount of time on research, this area could probably be
  424. explored more.  After all, the tests I did were only with a few
  425. cassette units.  If you feel like playing around with it yourself, let
  426. me know your results.  Incidentally, when connecting the audio to the
  427. second channel of my oscilloscope, I could see that the signal that is
  428. output by the cassette unit is about three periods delayed from the
  429. actual change over in the audio signal.  This might account for the
  430. rather unpredictable behavior that confused us.  Fun stuff to
  431. research.
  432.  
  433. All this weird behavior is probably caused by the fact that there is
  434. a slight difference in the output circuit of the filters for the mark
  435. and space tones, which is input into the comparator.  There is a small
  436. capacitor, which is charged by the output of the filter.  This charging
  437. takes some time, based on the value of the resistors in the circuit.
  438. Both filters have these resistors in their circuit, however one of these
  439. resistors differs slightly in value.  This is probably because in the
  440. absence of an audio signal, the recorder should output a mark value.
  441. If there is no signal, both filters output the same value, but due to
  442. this difference in the resistor value, the mark tone voltage on the input
  443. of the comparator will be the highest.  This design has one drawback.
  444. The charging time and discharging time of the capacitor is also influenced
  445. by this difference in resistor value.  This causes the space bits to be
  446. shorter.  I wonder if this problem could be solved by replacing the
  447. capacitor in the mark circuit by one of a lesser value.  For now, we will
  448. fix this problem in software.  I do not know whether all this is true for
  449. all the various types that Atari produced.
  450.  
  451. Troubleshooting.
  452.  
  453. If, after recording the .wav file to a cassette tape, the tape
  454. produces load errors or boot errors, obviously there must be something
  455. wrong.  Check to see that the audio has been properly recorded.  If
  456. you know where the boot error occurs, check that piece of the
  457. recording.  You might want to turn off any special noise suppressors
  458. that might be on your cassette deck.  For recording Atari stuff, I use
  459. regular tapes, because they are cheap, and because that is what these
  460. machines were designed for.  You should also try some of the other wave
  461. formats to see if that helps.  I had the best results with the zero
  462. transition option.
  463.  
  464. Sometimes, the playback of .wav data can be suspended due to various
  465. O.S. related issues.  If you feel that a data block has been hit by
  466. this, try recording the tape again.  Most commercial tapes are
  467. recorded on both sides, so we might apply the same tactics here.  If
  468. we record the .wav to both sides, we can try the other side, to see if
  469. the playback of the .wav file was affected by this.  If it is the
  470. case, the bad side of the tape could simply be recorded over again.
  471. If a certain portion of a tape is damaged, or suffers from a dropout,
  472. then the tape is unreliable, and I suggest you do not use it for
  473. recording data.
  474.  
  475. If you keep having trouble booting the cassette tape, first try
  476. booting the digital image with the CAS2SIO program and a SIO2PC cable.
  477. Like I stated in the WAV2CAS documentation, I have found that some of
  478. the load errors are not caused by the cassette unit at all.  Boot
  479. errors that are caused by timing problems can sometimes be corrected
  480. by specifying a fixed IRG value.  It is helpful to know whether the
  481. .cas file is okay to begin with.
  482.  
  483. If you are still having troubles with loading a specific tape, make
  484. sure you know what procedure to follow in order to boot these tapes.
  485. The tape might not be compatible with the XL/XE O.S., or you might
  486. need a certain amount of memory.  If you have a program that was
  487. written in BASIC, it will have been saved with the CSAVE command in
  488. BASIC, so use CLOAD instead on these tapes.  Anyway, make sure you
  489. know the proper procedure for the tape.
  490.  
  491. Another possibility is that there is simply a bug in my program.  If a
  492. load error occurs consistently at the same spot on the tape, even if
  493. you record it again, this might be a problem inside the program.  If
  494. this occurs, send me an E-mail.
  495.  
  496. Epilog.
  497.  
  498. Well, we have come to the end of this document, another project done.
  499. I hope this stuff helps some folks to learn to appreciate the cassette
  500. stuff a little more.  After all, if it is more reliable, it is not
  501. half as bad.  Booting a PC nowadays takes several minutes, so booting
  502. an Atari from tape might actually be faster, and lots more fun.  The
  503. source for this program is included, so if you feel you want to
  504. experiment some more, you are welcome to try it out.  Note that I did
  505. not put any of the PC's supposed to be 'C' crap in my source.  I still
  506. cannot find the words FAR and NEAR and such in Kernighan and Ritchie,
  507. so I compile all my sources with some switch that makes the PC choose
  508. the correct pointer stuff.  Select a proper memory model, whatever
  509. that may be, if you want to compile the stuff yourself.  Allocating
  510. two times 44,100 bytes does not make default PC pointer stuff happy so
  511. it seems.  Comments are welcome.  I might ignore them, since I will
  512. spend my time on other things now, but it is always nice to hear
  513. somebody tried to use the stuff.  The terms and conditions are the same
  514. as with the wav2cas stuff.  So, use this stuff at your own risk.  I am
  515. not responsible for any damage that might occur whatsoever.  If you want
  516. to take portions of my program and improve on it, go ahead, provided
  517. that you comply with a few rules.  You have to include in your
  518. documentation that your program was based on this work.  On top of that,
  519. if you charge money for your product, you will have to inform people
  520. that my stuff is available free of charge.  This includes shareware fees
  521. and stuff like that.  I just want people to know that this thing is
  522. available for free.  This means that I myself do not expect people to
  523. send me any money.  So, you get what you pay for with my stuff.  If you
  524. want to drop me a note, there are various options.  For one thing, you can
  525. send me E-mail over the Internet.  You can also send me a regular letter.
  526. Anyway, if you have questions, send them to me.  Please do not send me
  527. .wav files to look at.  It would be crazy to E-mail a file of several
  528. megabytes.  You are welcome to send any comments.  If you think some of
  529. my data or research is in error, let me know.  The address is below.
  530.  
  531. Ernest R. Schreurs.
  532. Kempenlandstraat 8
  533. 5211 VN  Den Bosch
  534. The Netherlands
  535. E-mail: ernest@wxs.nl
  536.  
  537. Keep those XL's/XE's humming.
  538. Or, I suppose we are talking to the real pioneers here:
  539. Keep those 400's/800's humming.
  540.